package rui.game.component.function;

import rui.game.component.GameFrame;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;

/**
 * @author 赵睿
 */
public class Exit extends JButton {

    public Exit() {
        this("退出游戏");
    }

    public Exit(String text) {
        super(text);
        globalSettings();
    }

    public static Exit init(Exit exit, GameFrame gameFrame, ActionListener actionListener) {
        if(exit ==null){
            exit =new Exit();
            gameFrame.getContentPane().add(exit);
            exit.addActionListener(actionListener);
        }
        return exit;
    }



    protected void globalSettings(){
        this.setFont(new Font("楷体", Font.BOLD, 12));
        this.setBounds(54, 483, 93, 40);
    }


}
